import {createRouter, createWebHistory} from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {path: '/', redirect: '/manager/home'},
    {
      path: '/manager', name: 'manager', component: () => import('@/views/Base.vue'),
      children: [
        {path: 'home', meta: {name: '主页'}, component: () => import('@/views/Home.vue')},
        {path: 'admin', meta: {name: '管理员信息'}, component: () => import('@/views/Admin.vue')},
        {path: 'notice', meta: {name: '公告管理'}, component: () => import('@/views/Notice.vue')},
        {path: 'user', meta: {name: '普通用户信息'}, component: () => import('@/views/User.vue')},
        {path: 'person', meta: {name: '个人中心'}, component: () => import('@/views/Person.vue')},
        {path: 'updatePassword', meta: {name: '修改密码'}, component: () => import('@/views/UpdatePassword.vue')},
      ]
    },
    {
      path: '/echarts', name: 'echarts', component: () => import('@/views/Base.vue'),
      children: [
        {path: 'line', meta: {name: '折线图'}, component: () => import('@/views/echarts/line.vue')},
        {path: 'bar', meta: {name: '柱状图'}, component: () => import('@/views/echarts/bar.vue')},
        {path: 'pie', meta: {name: '饼状图'}, component: () => import('@/views/echarts/pie.vue')},
      ]
    },
    {path: '/404', name: 'notfound', component: () => import('@/views/404.vue'),},
    {path: '/login', name: 'login', component: () => import('@/views/Login.vue'),},
    {path: '/register', name: 'register', component: () => import('@/views/Register.vue'),},
    {path: '/:pathMath(.*)', redirect: '/404',},
  ],
})

export default router
